import { request } from 'ice';

export default {
  list: async (params) => {
    const reParams = { page: params.current, limit: params.pageSize, ...params };
    delete reParams.current;
    delete reParams.pageSize;

    return await request({
      url: '/api/sys/oss/list',
      method: 'GET',
      params: reParams,
    });
  },
  config: async () => {
    return await request({
      url: '/api/sys/oss/config',
      method: 'GET',
    });
  },
  saveConfig: async (data) => {
    return await request({
      url: '/api/sys/oss/saveConfig',
      method: 'POST',
      data,
    });
  },
  upload: async (data) => {
    return await request({
      url: '/api/sys/oss/upload',
      method: 'POST',
      headers: { 'Content-Type': 'multipart/form-data', 'X-Requested-With': 'XMLHttpRequest' },
      data,
    });
  },
  delete: async (ids) => {
    return await request({
      url: '/api/sys/oss/delete',
      method: 'POST',
      data: ids,
    });
  },
};
